home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Controls / Visual Basic Controls.iso / vbcontrol / srtsltn / data1.cab / Target / Include / sortsoli.h < prev   
Encoding:
C/C++ Source or Header  |  1998-08-05  |  22.5 KB  |  396 lines

  1. #ifndef __SORTSOLI
  2. #define __SORTSOLI
  3. /***************************************************************************
  4.      Author:        Mario Westphal
  5.                     Copyright ⌐ 1997,98 by Mario M. Westphal
  6.      Version:       1.4.0
  7.  
  8.      Description:   Interface definitions for SORTSOL.DLL
  9. ****************************************************************************/
  10.  
  11. #ifdef __cplusplus
  12. extern "C" {
  13. #endif
  14.  
  15. #include <windows.h>
  16.  
  17. //###########################################################################
  18. // T y p e s
  19. //###########################################################################
  20. typedef unsigned long SSIH;
  21. typedef int SORTSOL_ERROR;
  22.  
  23.  
  24. //###########################################################################
  25. // M a x i m a 
  26. //###########################################################################
  27. #define SOSOMAX_RECLEN            65535            // unsigned short range!!!
  28. #define SOSOMAX_KEYS            64                // Maximum number of keys
  29. #define SOSOMAX_KEYLEN            65535            // Maximum keylen in byte
  30. #define SOSOMAX_THREADS            64                // Maximum Number of threads
  31. #define SOSOMAX_PREMERGECACHE    128                // Maxmimum number of entries in the pre-merge cache
  32. #define SOSOMAX_MERGEFILES        64                // Maximum number of merge files
  33. #define SOSOMIN_SORTMEM            65535            // Minimum memory per thread
  34. #define SOSOMIN_MERGEMEM        65535            // Minimum memory per thread
  35. #define SOSOMAX_EXPLICITNUMLEN  5                // Maximum length for explicit length
  36. #define SOSOMAX_DATETIME_MASK   100                // Maximum length of the date/time mask
  37. #define SOSOMAX_SEQUENCE_LENGTH 256                // Length of the sequence
  38. #define SOSOMAX_KEYDLL_NAME     40                // Maximum length of the Compare function name in a key dll
  39. #define SOSOMAX_USERDATA_LEN    40                // Maximum length for the "Data" parameter for keytype "User"
  40. #define SOSOMAX_TRAILEREXPR_LEN    40                // Maximum length for the expression in the TRAILER statement
  41.  
  42. //###########################################################################
  43. // E r r o r  C o d e s
  44. //###########################################################################
  45. #define SOSOERR_SUCCESS                        0
  46. #define    SOSOERR_FIRST                        20000
  47. #define SOSOERR_UNKNOWN                        (SOSOERR_FIRST + 1)
  48.  
  49. // Source file
  50.  
  51. #define SOSOERR_OPENSOURCE                    (SOSOERR_FIRST + 2)        // Error opening the source file
  52. #define SOSOERR_READSOURCE                    (SOSOERR_FIRST + 3)        // Error reading from the source file
  53. #define SOSOERR_SEEKSOURCE                    (SOSOERR_FIRST + 4)        // Error seeking in the source file
  54. #define SOSOERR_CLOSESOURCE                    (SOSOERR_FIRST + 5)        // Error closing the source
  55. #define SOSOERR_PARSESOURCE                    (SOSOERR_FIRST + 6)        // Error while parsing the structure of the source file
  56. #define SOSOERR_INVALIDFORMAT                (SOSOERR_FIRST + 7)        // Invalid file format
  57.  
  58. #define SOSOERR_RUNTIME                        (SOSOERR_FIRST + 8)        // Runtime error
  59. #define SOSOERR_MEMORY                        (SOSOERR_FIRST + 9)        // Out of memory
  60.  
  61. #define SOSOERR_EXPLICITOFFSET                (SOSOERR_FIRST + 10)    // Offset wrong
  62. #define SOSOERR_EXPLICITLEN                    (SOSOERR_FIRST + 11)    // Len > 5
  63. #define SOSOERR_EXPLICITRECLEN                (SOSOERR_FIRST + 12)    // Record to short
  64.  
  65. #define SOSOERR_ABORTED                        (SOSOERR_FIRST + 18)    // User abort
  66. #define SOSOERR_NORECORDS                    (SOSOERR_FIRST + 19)    // No records found in input file
  67.  
  68. #define SOSOERR_OPENDEST                    (SOSOERR_FIRST + 20)    // Error opening the destination file
  69. #define SOSOERR_WRITEDEST                    (SOSOERR_FIRST + 21)    // Error writing to the destination file
  70. #define SOSOERR_SEEKDEST                    (SOSOERR_FIRST + 22)    // Error seeking in the destination file
  71. #define SOSOERR_CLOSEDEST                    (SOSOERR_FIRST + 23)    // Error closing the destination file
  72. #define SOSOERR_DESTNOSPACE                    (SOSOERR_FIRST + 24)    // Not enough space on the destination drive
  73.  
  74. #define SOSOERR_OPENMERGE                    (SOSOERR_FIRST + 30)    // Error opening a merge file
  75. #define SOSOERR_READMERGE                    (SOSOERR_FIRST + 31)    // Error reading from a merge file
  76. #define SOSOERR_WRITEMERGE                    (SOSOERR_FIRST + 32)    // Error writing to a merge file
  77. #define SOSOERR_SEEKMERGE                    (SOSOERR_FIRST + 33)    // Error seeking in a merge file
  78. #define SOSOERR_CLOSEMERGE                    (SOSOERR_FIRST + 34)    // Error closing a merge file
  79. #define SOSOERR_GETMERGEFILENAME            (SOSOERR_FIRST + 35)    // Error retrieving a merge file name
  80. #define SOSOERR_NOMERGESPACE                (SOSOERR_FIRST + 36)    // All merge drives are full
  81. #define SOSOERR_NOMERGEDRIVESAVAIL            (SOSOERR_FIRST + 37)    // No merge drives are available
  82.  
  83. #define SOSOERR_CHECK_SOURCENOTFOUND        (SOSOERR_FIRST + 100)    // Source file not found
  84. #define SOSOERR_CHECK_CREATEDEST            (SOSOERR_FIRST + 101)    // Error creating the destination file
  85. #define SOSOERR_CHECK_INVALIDMERGEDRIVE        (SOSOERR_FIRST + 102)    // Invalid merge drive specified
  86.  
  87. #define SOSOERR_OPENLOG                        (SOSOERR_FIRST + 120)    // Error opening the logfile
  88. #define SOSOERR_WRITELOG                    (SOSOERR_FIRST + 121)    // Error writing the logfile
  89.  
  90. #define SOSOERR_NOKEYSDEFINED                (SOSOERR_FIRST + 200)    // No keys defined
  91. #define SOSOERR_ERRORCREATEINSTANCE            (SOSOERR_FIRST + 201)    // Error creating a sort instance
  92. #define SOSOERR_ERRORINVALIDERRORCODE        (SOSOERR_FIRST + 202)    // Invalid error code for SSIGetErrorMessage
  93.  
  94. #define SOSOERR_KEYDLL_NOTFOUND                (SOSOERR_FIRST + 300)   // User DLL was not found
  95. #define SOSOERR_KEYDLL_COMPARE_NOTFOUND        (SOSOERR_FIRST + 301)   // The specified compare function could not be found in the DLL
  96. #define SOSOERR_KEYDLL_NO_NAME                (SOSOERR_FIRST + 302)   // The key definition does not contain a valid DLL name
  97. #define SOSOERR_KEYDLL_NO_COMPARENAME        (SOSOERR_FIRST + 303)   // The key definition does not contain a valid compare function name
  98.  
  99. #define SOSOERR_INVALIDMEMORYORPOINTER        (SOSOERR_FIRST + 999)    // Invalid memory pointer given to one of the API's
  100.  
  101. // Invalid parameters
  102.  
  103. #define SOSOERR_PARAM_INVALIDHANDLE                (SOSOERR_FIRST + 1000)    // Invalid handle given
  104. #define SOSOERR_PARAM_INVALIDPARAM                (SOSOERR_FIRST + 1001)    // Invalid parameter
  105. #define SOSOERR_PARAM_INPUTFILENAME                (SOSOERR_FIRST + 1002)    // Invalid source filename
  106. #define SOSOERR_PARAM_OUTPUTFILENAME            (SOSOERR_FIRST + 1003)    // Invalid destination file name
  107. #define SOSOERR_PARAM_MERGEDRIVES                (SOSOERR_FIRST + 1004)    // Invalid merge drive specification
  108. #define SOSOERR_PARAM_FILETYPE                    (SOSOERR_FIRST + 1005)    // Unknown file type
  109. #define SOSOERR_PARAM_RECLEN                    (SOSOERR_FIRST + 1006)    // Invalid reclen
  110. #define SOSOERR_PARAM_DELIMETERS                (SOSOERR_FIRST + 1007)    // Invalid delimeter specification
  111. #define SOSOERR_PARAM_FIELDS                    (SOSOERR_FIRST + 1008)    // Fields argument required in key specification
  112. #define SOSOERR_PARAM_EXPLICITLEN                (SOSOERR_FIRST + 1009)    // Error in SORTSOL_FTYPE_EXPLICIT filetype
  113. #define SOSOERR_PARAM_INVALIDKEYTYPE            (SOSOERR_FIRST + 1010)    // Unknown key type
  114. #define SOSOERR_PARAM_DATEADJUST                (SOSOERR_FIRST + 1011)    // Error in date adjust specifier
  115. #define SOSOERR_PARAM_KEYPOS                    (SOSOERR_FIRST + 1012)    // Invalid key position
  116. #define SOSOERR_PARAM_KEYOFFSET                    (SOSOERR_FIRST + 1013)    // Invalid key offset
  117. #define SOSOERR_PARAM_WRONGFORMAT_FOR_KEYTYPE    (SOSOERR_FIRST + 1014)    // Wrong file format for key type
  118. #define SOSOERR_PARAM_HEADERSIZE                (SOSOERR_FIRST + 1015)    // Invalid header size
  119. #define SOSOERR_PARAM_FILESIZEMISMATCH            (SOSOERR_FIRST + 1016)    // File site must match record length (SORTSOL_FTYPE_FIXED)
  120. #define SOSOERR_PARAM_TOMANYKEYS                (SOSOERR_FIRST + 1017)    // To many keys specified
  121. #define SOSOERR_PARAM_INVALIDMASK                (SOSOERR_FIRST + 1018)    // Invalid date/time mask
  122. #define SOSOERR_PARAM_INVALIDSEQUENCE            (SOSOERR_FIRST + 1019)    // Invalid sequence
  123. #define SOSOERR_PARAM_INVALIDKEYLEN                (SOSOERR_FIRST + 1020)    // Invalid key len
  124. #define SOSOERR_PARAM_DRIVESPACE                (SOSOERR_FIRST + 1021)  // Error in CheckDriveSpace statement
  125.  
  126. #define SOSOERR_VERSIONINFO                        (SOSOERR_FIRST + 1030)    // Error retrieving the version information
  127.  
  128. // Command file related errors (CreateFromFile() API)
  129.  
  130. #define SOSOERR_CMDFILENOTFOUND                    (SOSOERR_FIRST + 2000)    // Command file not found
  131. #define SOSOERR_INVALIDCMDFILENAME                (SOSOERR_FIRST + 2001)    // Invalid command file name
  132. #define SOSOERR_OPENCMDFILE                        (SOSOERR_FIRST + 2002)    // Error opening the command file
  133. #define SOSOERR_UNKNOWNKEYWORD                    (SOSOERR_FIRST + 2003)    // Unknown keyword found
  134. #define SOSOERR_MISSINGOP                        (SOSOERR_FIRST + 2004)    // Missing "("
  135. #define SOSOERR_MISSINGCP                        (SOSOERR_FIRST + 2005)    // Missing ")"
  136. #define SOSOERR_NODRIVES                        (SOSOERR_FIRST + 2006)    // Argument missing in DRIVES statement
  137. #define SOSOERR_INVALIDDRIVES                    (SOSOERR_FIRST + 2007)    // Invalid DRIVES statement
  138. #define SOSOERR_DRIVESPARE                        (SOSOERR_FIRST + 2008)    // Invalid DRIVESPARE statement
  139. #define SOSOERR_THREADS                            (SOSOERR_FIRST + 2009)    // Invalid THREADS statement
  140. #define SOSOERR_CACHES                            (SOSOERR_FIRST + 2010)    // Invalid CACHES statement
  141. #define SOSOERR_SORTMEM                            (SOSOERR_FIRST + 2011)    // Invalid SORTMEM statement
  142. #define SOSOERR_MERGEMEM                        (SOSOERR_FIRST + 2012)    // Invalid MERGEMEM statement
  143. #define SOSOERR_RANGE                            (SOSOERR_FIRST + 2013)    // Invalid RANGE statement
  144. #define SOSOERR_FILTER_ARGS                        (SOSOERR_FIRST + 2014)    // Invalid arguments in FILTER statement
  145. #define SOSOERR_FILTER_TYPE                        (SOSOERR_FIRST + 2015)    // Invalid type in FILTER
  146. #define SOSOERR_FILTER_FTREMOVE_ARGS            (SOSOERR_FIRST + 2016)    // Invalid remove sepcifier in FILTER statement
  147. #define SOSOERR_INPUTFILE                        (SOSOERR_FIRST + 2017)    // Invalid INPUTFILE statement
  148. #define SOSOERR_INPUTFILEDELETE                    (SOSOERR_FIRST + 2018)    // Invalid delete specifier for INPUTFILE statement
  149. #define SOSOERR_OUTPUTFILE                        (SOSOERR_FIRST + 2019)    // Invalid OUTPUTFILE statement
  150. #define SOSOERR_LOGFILE                            (SOSOERR_FIRST + 2020)    // Invalid LOGFILE statement
  151. #define SOSOERR_COMPRESS                        (SOSOERR_FIRST + 2021)    // Invalid COMPRESS statement
  152. #define SOSOERR_HEADER                            (SOSOERR_FIRST + 2022)    // Invalid HEADER statement
  153. #define SOSOERR_HEADERLEN                        (SOSOERR_FIRST + 2023)    // Invalid "length" specifier in HEADER
  154. #define SOSOERR_HEADER_INBYTES                    (SOSOERR_FIRST + 2024)    // Invalid "in bytes" specifier in HEADER
  155. #define SOSOERR_HEADER_KEEP                        (SOSOERR_FIRST + 2025)    // Invalid "keep" specifier in HEADER
  156. #define SOSOERR_FILETYPE_ARGS                    (SOSOERR_FIRST + 2026)    // Invalid arguments for FILETYPE
  157. #define SOSOERR_FILETYPE_UNKNOWN                (SOSOERR_FIRST + 2027)    // Unknown FILETYPE
  158. #define SOSOERR_FILETYPE_INVALIDRECLEN            (SOSOERR_FIRST + 2028)    // Invalid record length specifier in FILETYPE
  159. #define SOSOERR_FILETYPE_SEPARATOR                (SOSOERR_FIRST + 2029)    // Invalid separator
  160. #define SOSOERR_FILETYPE_DELIMETER                (SOSOERR_FIRST + 2030)    // Invalid delimeter
  161. #define SOSOERR_FILETYPE_TOMANYFIELDS            (SOSOERR_FIRST + 2031)    // SORTSOL_FTYPE_EXPLICIT: To many fields specified
  162. #define SOSOERR_FILETYPE_EXINVALIDOFS            (SOSOERR_FIRST + 2032)    // SORTSOL_FTYPE_EXPLICIT: Invalid offset
  163. #define SOSOERR_FILETYPE_EXINVALIDLEN            (SOSOERR_FIRST + 2033) // SORTSOL_FTYPE_EXPLICIT: Invalid length
  164. #define SOSOERR_FILETYPE_EXINVALIDBINSPEC        (SOSOERR_FIRST + 2034)    // SORTSOL_FTYPE_EXPLICIT) Invalid "binary" specifier
  165. #define SOSOERR_KEY_ARGS                        (SOSOERR_FIRST + 2035)    // Invalid arguments found in KEY
  166. #define SOSOERR_KEY_INVALIDTYPE                    (SOSOERR_FIRST + 2036)    // Invalid KEY type
  167. #define SOSOERR_KEY_INVALIDSORTORDER            (SOSOERR_FIRST + 2037)    // Unknown "sort order" specifier
  168. #define SOSOERR_KEY_INVALIDPOS                    (SOSOERR_FIRST + 2038)    // Invalid "position" specifier
  169. #define SOSOERR_KEY_INVALIDOFS                    (SOSOERR_FIRST + 2039)    // Invalid "offset" specifier
  170. #define SOSOERR_KEY_INVALIDLEN                    (SOSOERR_FIRST + 2040)    // Invalid "length" specifier
  171. #define SOSOERR_KEY_INVALIDDECPL                (SOSOERR_FIRST + 2041)    // Invalid "decimal places" specifier
  172. #define SOSOERR_KEY_MASKTOLONG                    (SOSOERR_FIRST + 2042)    // Date/time mask too long
  173. #define SOSOERR_KEY_MASKTOSHORT                    (SOSOERR_FIRST + 2043)    // Date/time mask too shoort
  174. #define SOSOERR_KEY_SEQUENCETOSHORT                (SOSOERR_FIRST + 2044)    // Sequence less than 256 byte
  175. #define SOSOERR_KEY_PRIMLANG                    (SOSOERR_FIRST + 2045)    // Unknown primary language
  176. #define SOSOERR_KEY_SUBLANG                        (SOSOERR_FIRST + 2046)    // Unknown sub-language
  177. #define SOSOERR_KEY_DATEADJUST                    (SOSOERR_FIRST + 2047)    // Invalid "date adjust" specifier
  178. #define SOSOERR_PRIORITY                        (SOSOERR_FIRST + 2048)    // Invalid priority
  179. #define SOSOERR_OUTPUTFILEAPPEND                (SOSOERR_FIRST + 2049)    // TRUE to append to an existing output file
  180. #define SOSOERR_KEYDLL_DATAOUTOFRANGE           (SOSOERR_FIRST + 2050)  // "Data" to long in User key
  181.  
  182. #define SOSOERR_PARAM_TRAILER_WRONGTYPE            (SOSOERR_FIRST + 2070)  // Wrong type in TRAILER statement
  183. #define SOSOERR_PARAM_TRAILER_KEEP                (SOSOERR_FIRST + 2071)    // Invalid "keep" specifier in TRAILER
  184. #define SOSOERR_PARAM_TRAILER_EXPR_TOO_LONG        (SOSOERR_FIRST + 2072)    // Expression in TRAILER exceeds SOSOMAX_TRAILEREXPR_LEN
  185. #define SOSOERR_PARAM_TRAILER_LEN                (SOSOERR_FIRST + 2073)    // Length in TRAILER invalid
  186.     
  187. #define SOSOERR_TRAILER_LEN                        (SOSOERR_FIRST + 2080)    // TRAILER size bigger than input file size
  188. #define SOSOERR_TRAILER_SAVETEMP                (SOSOERR_FIRST + 2081)    // Error while saving the TRAILER to a temporary file
  189. #define SOSOERR_TRAILER_READTEMP                (SOSOERR_FIRST + 2082)    // Error while reading the TRAILER from a temporary file
  190. #define SOSOERR_TRAILER_READINPUT                (SOSOERR_FIRST + 2083)    // Error while parsing the input file for the trailer
  191.  
  192. //###########################################################################
  193. // F i l e  T y p e s
  194. //###########################################################################
  195. #define SORTSOL_FTYPE_FIXED        0    // Fixed length records: each record has the same length
  196. #define SORTSOL_FTYPE_DELIMITED    1    // Delimeted file: each record is delimeted with a character or pair of characters
  197. #define SORTSOL_FTYPE_COUNTED    2    // Counted file, consisting of fields separated by a character, each record contains the same number of fields
  198. #define SORTSOL_FTYPE_EXPLICIT    3    // File with explicit record length; each record contains an explicit length field in the first n bytes
  199.  
  200.  
  201. //###########################################################################
  202. // F i l t e r s
  203. //###########################################################################
  204. #define SORTSOL_FILTER_REMOVEDUPL_RECORD    0    // Remove duplicate records
  205. #define SORTSOL_FILTER_REMOVEDUPL_KEY        1    // Remove based on key comparison
  206.  
  207.  
  208. //###########################################################################
  209. // N o t i f i c a t i o n s
  210. //###########################################################################
  211.  
  212. #define SORTSOL_NOTIFY_SORTPERCENTAGE    1    // The sort percentage is updated
  213. #define SORTSOL_NOTIFY_MERGEPERCENTAGE    2    // The merge percentage is updated
  214. #define SORTSOL_NOTIFY_BEGINSORT        3    // The sort begins
  215.     #define SORTSOL_STATUS_ONEPHASESORT    1    // In-memory sort
  216.     #define SORTSOL_STATUS_MERGESORT    2    // Mergesort
  217. #define SORTSOL_NOTIFY_FINISHSORT        4    // The sort is finished
  218. #define SORTSOL_NOTIFY_BEGINMERGE        5    // The merge begins
  219. #define SORTSOL_NOTIFY_FINISHMERGE        6    // The merge is finished
  220. #define SORTSOL_NOTIFY_FINISHED            20    // The complete sort is finished
  221.  
  222. // The notifications callback
  223. typedef BOOL (CALLBACK* SORTSOL_NOTIFYCALLBACK)(UINT Code, DWORD StatusData, DWORD Extra);
  224.  
  225.  
  226. //###########################################################################
  227. // S u p p o r t e d  K e y  T y p e s
  228. //###########################################################################
  229.  
  230. #define SORTSOL_KEY_Generic            0
  231. #define SORTSOL_KEY_String            1
  232. #define SORTSOL_KEY_StringN            2
  233. #define SORTSOL_KEY_StringNLS        3
  234. #define SORTSOL_KEY_StringNLSN        4
  235. #define SORTSOL_KEY_ShortInt        5
  236. #define SORTSOL_KEY_UShortInt        6
  237. #define SORTSOL_KEY_LongInt            7
  238. #define SORTSOL_KEY_ULongInt        8
  239. #define SORTSOL_KEY_LongInt64        9
  240. #define SORTSOL_KEY_ULongInt64        10
  241. #define SORTSOL_KEY_Float            11
  242. #define SORTSOL_KEY_Double            12
  243. #define SORTSOL_KEY_LDouble            13
  244. #define SORTSOL_KEY_IntS            14
  245. #define SORTSOL_KEY_UIntS            15
  246. #define SORTSOL_KEY_IntS64            16
  247. #define SORTSOL_KEY_UIntS64            17
  248. #define SORTSOL_KEY_DoubleS            18
  249. #define SORTSOL_KEY_FixDecimal        19
  250. #define SORTSOL_KEY_Date            20
  251. #define SORTSOL_KEY_Time            21
  252. #define SORTSOL_KEY_UDS                22
  253. #define SORTSOL_KEY_UserKey            23
  254.  
  255. // Maximum number of keys (highest index)
  256. #define SORTSOL_KEY_MAX                23
  257.  
  258.  
  259. //###########################################################################
  260. // S t r u c t u r e s
  261. //###########################################################################
  262.  
  263. #pragma pack(1)
  264.  
  265. // INTERNAL USE ONLY
  266. // Information about the sorted file
  267. typedef struct tagSORTSOL_FILEINFO
  268. {
  269.     unsigned int    uSize;                                    // Size of this structure
  270.     int                nType;                                    // FILETYPE
  271.     BOOL            bKeepHeader;                            // Keep the header?
  272.     UINT            uHeaderElements;                        // Number of elements in the header
  273.     BOOL            bHeaderInByte;                            // TRUE => in byte, else in records
  274.     USHORT            uTrailerType;                            // Type of the trailer (0 = none, 1 = Count, 2 = Parse)
  275.     char            cTrailerExpr[SOSOMAX_TRAILEREXPR_LEN+1];// The text that defines the "EOF"
  276.     int                nTrailerSize;                            // Number of bytes in the trailer
  277.     BOOL            bKeepTrailer;                            // Move the trailer into the output file?
  278.     USHORT            uRecLen;                                // Record lengh (SORTSOL_FTYPE_FIXED)
  279.     USHORT            uFields;                                // Number of fields (SORTSOL_FTYPE_EXPLICIT)
  280.     USHORT            uExplicitLen;                            // Length of the explicit length specifier
  281.     USHORT            uExplicitOffset;                        // Offset of the explicit length specifier
  282.     BOOL            bExplicitIBinary;                        // Is the explicit length specifier binary?
  283.     char            cSeparator;                                // Field separator
  284.     UINT            uNoOfDelimeters;                        // Number of characters in Delimeters
  285.     char            Delimeters[2];                            // Maximum two delimeters
  286. } SORTSOL_FILEINFO;
  287.  
  288.  
  289. // INTERNAL USE ONLY
  290. // This structure defines the information required by the sort functions
  291. typedef struct tagSORTSOL_SORTINFO
  292. {
  293.     unsigned int        uSize;                        // The size in byte of this  structure
  294.     TCHAR                cInputFileName[MAX_PATH];    // The name of the input file
  295.     TCHAR                cOutputFileName[MAX_PATH];    // The name of the output file
  296.     BOOL                bAppendOutput;                // TRUE to append to an existing output file
  297.     TCHAR                cLogFileName[MAX_PATH];        // The name of the logfile
  298.     BOOL                bAppendLog;                    // TRUE if the new log is appended if the logfile exists
  299.     TCHAR                cMergeDrives[100];            // List of merge drives
  300.     USHORT                nNumberOfThreads;            // Number of threads
  301.     USHORT                nCacheEntries;                // Number of pre-merge caches
  302.     DWORD                dwSortMemory;                // Memory in byte per thread
  303.     DWORD                dwMergeMemory;                // Memory in byte for the merge
  304.     BOOL                bUseCompression;            // Use compression for the merge files (Windows NT / NTFS only)
  305.     BOOL                bCompressOutput;            // Use compression for the output file (Windows NT / NTFS only)
  306.     BOOL                bDeleteInput;                // TRUE => delete the input file after sorting
  307.     DWORD                dwDriveSpare;                // Drive spare factor
  308.     BOOL                bSkipDriveSpaceCheck;        // Skip the drive space check
  309.     DWORD                dwRange;                    // Output range
  310.     SORTSOL_FILEINFO    FileInfo;                    // File format information (see above)
  311. } SORTSOL_SORTINFO;
  312.  
  313.  
  314. // INTERNAL USE ONLY
  315. // This structure contains all information required to describe a key
  316. typedef struct tagSORTSOL_KEYDEF
  317. {
  318.     unsigned int        uSize;                                // size of this structure in byte
  319.     int                    nType;                                // KEY type
  320.     BOOL                bAscending;                            // TRUE: Ascending, else Descending
  321.     USHORT                uKeyLen;                            // Key length
  322.     USHORT                uKeyOffset;                            // Key offset 
  323.     USHORT                uKeyPos;                            // Key position
  324.     LCID                Locale;                                // Locale identifier for NLS keys
  325.     char                cDecimalPointChar;                    // Char for the decimal point
  326.     int                    nTwoDigitDateAdjust;                // Date adjust value
  327.     USHORT                uDecimalPlaces;                        // Number of decimal places
  328.     char                cSequence[SOSOMAX_SEQUENCE_LENGTH];    // Sequence
  329.     char                cMask[SOSOMAX_DATETIME_MASK];        // Date/time mask
  330.     char                cKeyDLL[MAX_PATH];                    // Name of the Key-DLL
  331.     char                cKeyName[SOSOMAX_KEYDLL_NAME];        // Name of the Compare function
  332.     char                cUserData[SOSOMAX_USERDATA_LEN];    // Extra data passed to a "User" key
  333. } SORTSOL_KEYDEF;
  334.  
  335.  
  336. // This structure is used with SSIGetStats() to query
  337. // sort statistics
  338. typedef struct tagSORTSOL_STATS
  339. {
  340.     unsigned int    uSize;                            // size of this structure in byte
  341.     LARGE_INTEGER    liBytesSorted;                    // Number of bytes sorted
  342.     DWORD            dwSortTime;                        // Time in ms for the sort
  343.     DWORD            dwMergeTime;                    // Time in ms for the merge
  344.     DWORD            dwAvgBlockLoadTime;                // Average time for loading a run in ms
  345.     DWORD            dwAvgBlockSortTime;                // Average time to sort a run in ms
  346.     DWORD            dwAvgBlockMergeTime;            // Average time for pre-merge
  347.     LARGE_INTEGER    liRecordsProcessed;                // Number of records processed
  348.     LARGE_INTEGER    liRecordsFiltered;                // Number of records filtered
  349.     DWORD            dwNumberOfRuns;                    // Number of runs to merge
  350.     DWORD            dwCachePerRun;                    // Cache size in byte per run
  351. } SORTSOL_STATS;
  352.  
  353.  
  354. // This structure is used by SSICreateFromFile and SSICreateFromCommandString
  355. // to transport data into and from the functions
  356. typedef struct tagSORTSOL_CMDFILESTATUS
  357. {
  358.     unsigned int    uSize;                            // size of this structure in byte
  359.     int                LineNo;                            // OUT:        Line where the error occured
  360.     TCHAR            ErrLine[256];                    // OUT:        The raw content of the line
  361.     BOOL            Override;                        // IN:      TRUE if the members of this structure override settings from the profile
  362.     TCHAR            InputFileName[MAX_PATH];        // IN/OUT:    The name of the input file
  363.     BOOL            DeleteInput;                    // IN/OUT:  TRUE if the input file is deleted after the sort
  364.     TCHAR            OutputFileName[MAX_PATH];        // IN/OUT:    The name of the destination file
  365.     BOOL            AppendOutput;                    // IN/OUT:    TRUE if new data is appended to the output file
  366.     TCHAR            LogFileName[MAX_PATH];            // IN/OUT:    The name of the logfile
  367.     BOOL            AppendLog;                        // IN:        TRUE if new data should be appended to the log file
  368.     DWORD            PriorityClass;                    // OUT:        The PRIORITY-setting from the command file
  369.  
  370. } SORTSOL_CMDFILESTATUS;
  371.  
  372. #pragma pack()
  373.  
  374. //###########################################################################
  375. // E x p o r t e d  F u n c t i o n s
  376. //###########################################################################
  377.  
  378. SORTSOL_ERROR WINAPI SSICreateFromFile(SSIH* pHandle, LPCTSTR Filename, SORTSOL_CMDFILESTATUS* pStatus);
  379. SORTSOL_ERROR WINAPI SSICreateFromCommandString(SSIH* pHandle, LPCTSTR Commands, SORTSOL_CMDFILESTATUS* pStatus);
  380.  
  381. SORTSOL_ERROR WINAPI SSISort(SSIH Handle);
  382. SORTSOL_ERROR WINAPI SSIFree(SSIH Handle);
  383.  
  384. SORTSOL_ERROR WINAPI SSIRegisterCallback(SSIH Handle, SORTSOL_NOTIFYCALLBACK lpCallback, DWORD Extra);
  385.  
  386. SORTSOL_ERROR WINAPI SSIGetStats(SSIH Handle, SORTSOL_STATS* pStats);
  387. SORTSOL_ERROR WINAPI SSIGetErrorMessage(SORTSOL_ERROR ErrorCode, LPTSTR lpBuffer, DWORD* nSize);
  388. SORTSOL_ERROR WINAPI SSIGetVersion(DWORD* pVNMS, DWORD* pVNLS);
  389.  
  390.  
  391. #ifdef __cplusplus
  392.     }
  393. #endif
  394.  
  395. #endif // __SORTSOLI
  396.